<template>
	<view class="last_record">
		<view class="title">
			<view>维保历史</view>
			<view class="more" @click="toInfo">
				更多记录
				<uni-icons color="#666" size="14" type="arrowright"></uni-icons>
			</view>
		</view>
		<view v-if="msg.typeStatus" class="typeStatus">
			<view class="des">
				<!-- {{Object.keys(msg).length}} -->
				{{ ['保养','维修','救援','配件','事务','质检'][msg.typeStatus-1] }}
			</view>
			<!-- <view class="imagBox" v-if="msg.lastImgUrl">
				<image-drag-sort :max="9" @changeList="changeImg" :list="obj.disposeImgUrl" :disabled="true"></image-drag-sort>
			</view> -->
			<view class="status">
				<view class="finishtime">完成时间:{{ msg.updateTime }}</view>
			</view>
		</view>
		<view v-else class="empty">未发现维修/保养记录</view>
	</view>
</template>

<script>
import ImageDragSort from '@/components/image-drag-sort/index.vue';
import { mapState, mapActions } from 'vuex';
export default {
	props: {
		msg: {
			type: Object
		}
	},
	components: {
		ImageDragSort
	},
	computed: {
		...mapState('user', ['userinfo'])
	},
	data() {
		return {};
	},
	methods: {
		// previewImage() {
		// 	console.log('查看图片');
		// }
		// 去历史详情页
		toInfo() {
			const { buildingName, elevatorId, elevatorAddress, planId } = this.msg;
			uni.navigateTo({
				url: '/subpages/elevator/projectInfo/eleDetail?id=' + elevatorId + '&type=' + 1,
			});
			return;
			let data = {
				name: buildingName,
				// buildingId:this.listObj.buildingId,
				address: elevatorAddress,
				elevatorId: elevatorId,
				planId: planId,
				planStatus:4
			};
			uni.setStorage({
				key: 'statistical',
				data: {
					id: this.userinfo.user_id,
					title: this.userinfo.deptNames && this.userinfo.deptNames.length ? this.userinfo.deptNames[0] : '',
					groupId: this.userinfo.dept_id,
					
				},
				success: res => {
					let str = '/pageModules/myElevator/myElevatorInfo?data=' + JSON.stringify(data);
					uni.navigateTo({
						url: str,
						fail(err) {
							console.log(err);
						}
					});
				}
			});
		}
	}
};
</script>

<style lang="scss" scoped>
.last_record {
	.title {
		font-size: 32rpx;
		color: #333;
		font-weight: bold;
		padding-bottom: 22rpx;
		display: flex;
		align-items: center;
		.more {
			display: flex;
			font-weight: normal;
			flex: 1;
			padding: 10rpx 0;
			justify-content: flex-end;
			font-size: 24rpx;
			color: #666;
		}
	}
	.des {
		// margin-bottom: 20rpx;
		font-weight: bold;
		font-size: 28rpx;
		color: #333;
	}
	.imagBox {
		// margin: 20rpx;
		display: flex;
		flex-wrap: wrap;
		image {
			width: 120rpx;
			height: 120rpx;
			margin-right: 18rpx;
		}
	}
	.typeStatus{
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .status {
    display: flex;
    font-size: 24rpx;
    .finishtime {
      color: #999;
      margin-left: 10rpx;
    }
  }
	
}
</style>
